package com.prs.crm.domain.hr;

import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.OrderBy;
import javax.persistence.Table;

import com.prs.crm.domain.FlowCodeEntity;
import com.prs.crm.domain.oa.schedule.Diary;
import com.prs.crm.domain.oa.schedule.OthersThings;
import com.prs.crm.domain.sys.Code;

@Table(name="hr_dept")
@Entity
@SuppressWarnings("serial")
public class Dept extends FlowCodeEntity{
	
	@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
	private Integer id;
	private String deptcode;
	private String name;
	@ManyToOne
	private Dept parent;
	@OneToMany(mappedBy="parent")
	private Set<Dept> childs;
	private String type;
	@Lob
	private String remark;
	@OrderBy
	@OneToMany(fetch=FetchType.LAZY,mappedBy="dept")
	private Set<Resume> resumes;
	
	@OneToMany(fetch=FetchType.LAZY,mappedBy="dept")
	private Set<Person> persons;

	private Integer state;
	private String tableName;
	private String baseName;
	@Lob
	private String allfieldname;
//	@OneToOne(fetch=FetchType.LAZY,mappedBy="dept")
//	private Code code;
	
	
	public String getAllfieldname() {
		return allfieldname;
	}
	public void setAllfieldname(String allfieldname) {
		this.allfieldname = allfieldname;
	}
	public String getTableName() {
		return tableName;
	}
	public void setTableName(String tableName) {
		this.tableName = tableName;
	}
	public String getBaseName() {
		return baseName;
	}
	public void setBaseName(String baseName) {
		this.baseName = baseName;
	}
	public Integer getState() {
		return state;
	}
	public void setState(Integer state) {
		this.state = state;
	}
	public Set<Person> getPersons() {
		return persons;
	}
	public void setPersons(Set<Person> persons) {
		this.persons = persons;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public Integer getId() {
		return id;
	}
	
	public String getDeptcode() {
		return deptcode;
	}
	public void setDeptcode(String deptcode) {
		this.deptcode = deptcode;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}

	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public String getRemark() {
		return remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	public void setParent(Dept parent) {
		this.parent = parent;
	}
	public Dept getParent() {
		return parent;
	}
	public void setResumes(Set<Resume> resumes) {
		this.resumes = resumes;
	}
	public Set<Resume> getResumes() {
		return resumes;
	}
	public void setChilds(Set<Dept> childs) {
		this.childs = childs;
	}
	public Set<Dept> getChilds() {
		return childs;
	}
	
//	public Code getCode() {
//		return code;
//	}
//	public void setCode(Code code) {
//		this.code = code;
//	}
	
}
